import Vue from 'vue'
import VueRouter from 'vue-router'
import Router from 'vue-router'
import Main from './views/Main.vue'

const originPush =VueRouter.prototype.push
VueRouter.prototype.push=function push(location){
  return originPush.call(this,location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'Main',
      component: Main,
      children:[
        {
          path:"/",
          name:"home",
          component:()=>import('@/views/Home/Home') //=> 两侧不能有空格
        },{
          path:'/mall',
          name:'mall',
          component:()=>import('@/views/Mall/Mall')
        },{
          path:'/user',
          name:'user',
          component:()=>import('@/views/User/User')
        }
      ]
    }
  ]
})
